package com.parking.status.sync.netty.client;


import com.parking.status.sync.netty.entity.MessageBody;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.codec.MessageToMessageEncoder;

import java.util.List;

/**
 * Created by Administrator on 2015/9/15.
 */
public class BodyFrameEncoder extends MessageToByteEncoder<MessageBody> {

    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, MessageBody messageBody, ByteBuf out) {
        byte[] datas = messageBody.toBytes();
        out.writeBytes(datas);
        //channelHandlerContext.flush();
    }
}
